import { createRouter, createWebHistory } from "vue-router";

const routes = [
    {
        path: '/',
        component: ()=>import('@/components/Index.vue'), // 父路由：公共布局（侧边栏+头部+footer）
        children: [ // 子路由：仅替换main区域的内容
            { path: '', redirect: 'home' }, // 默认跳转首页
            {
                path: 'home',
                name:'home',
                component: ()=>import('@/components/Home.vue'),
                children:[
                    {
                        path:'',
                        name:'HomeDefault',
                        component: ()=>import('@/views/home/HomeDefault.vue')
                    },
                    {
                        path:'attendance',
                        name:'attendance',
                        component: ()=>import('@/views/home/Attendance.vue')
                    },
                    {
                        path:'department',
                        name:'Department',
                        component: ()=>import('@/views/home/Department.vue')
                    },
                    {
                        path:'entry',
                        name:'Entry',
                        component: ()=>import('@/views/home/Entry.vue')
                    },
                    {
                        path:'exit',
                        component: ()=>import('@/views/home/Exit.vue')
                    },
                ]},
            {
                path: 'staff',
                name:'Staff',
                component:  ()=>import('@/components/Staff.vue')
            },
            {
                path: 'performance',
                name:'performance',
                component:  ()=>import('@/components/Performance.vue')
            },
            {
                path: 'hire',
                name:'hire',
                component:  ()=>import('@/components/Hire.vue')
            },


            ]

    },
    {
        path: '/login',
        name: 'login',
        component:() => import('@/components/Login.vue')

    },
];

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL || '/'),
    routes,
});

export default router;